#include "public.h"
#include "seg.h"
#include <stdio.h>

uint count = 0;
uint time = 0;
uchar seg_str[16];  //显示的字符
uchar seg_buf[8];  //字符段码

void seg_demo() {
	uchar i;
	if(count >= 100) {
		count = 0;
		if(++time >= 60) {
			time = 0;
		}
		seg_tran(seg_str, seg_buf);
	}
	sprintf(seg_str, "%u", time);
	for(i=0; i<8; i++)
		seg_disp(i, seg_buf);
}

void main() {
	sys_init();
	timer1_init();

	while(1) {
		seg_demo();
	}
}

void timer1_isr() interrupt 3 {
	TH1 = (65535-10000)/256;  //10ms
	TL1 = (65535-10000)%256;
	count++;
}
